package org.ymjava.medical.db.AllPackage.biz;

import org.springframework.stereotype.Service;

import org.ymjava.medical.db.AbstractBaseBiz.BaseBiz;
import org.ymjava.medical.db.AllPackage.entity.PrepareForUser;
import org.ymjava.medical.db.AllPackage.mapper.PrepareForUserMapper;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;


/**
 * 
 *
 * @author zhy
 * @email ${email}
 * @date 2020-04-01 09:42:13
 */
@Service
public class PrepareForUserBiz extends BaseBiz<PrepareForUserMapper,PrepareForUser> {

    @Resource
    PrepareForUserMapper userMapper;

    public List<PrepareForUser> queryPostion(Integer userId, Integer classId){
        System.out.println(classId);
        System.out.println(userId);
        Example example = new Example(PrepareForUser.class);
        example.createCriteria().andIsNotNull("postition").andEqualTo("prepareId",classId).andEqualTo("userId",userId).andIsNull("wrong").andEqualTo("deleted",0).andEqualTo("type",0);
        return userMapper.selectByExample(example);
    }


    public List<PrepareForUser> queryWrong(Integer questionId,Integer bankId){
        Example example = new Example(PrepareForUser.class);
        example.createCriteria().andEqualTo("questionId",questionId).andEqualTo("bankId",bankId).andIsNotNull("wrong").andIsNull("postition").andEqualTo("deleted",0);
        return userMapper.selectByExample(example);
    }

    public List<PrepareForUser> queryPosition(Integer userId,Integer typeId,Integer classId){

        Example example = new Example(PrepareForUser.class);
        example.createCriteria().andEqualTo("userId",userId).andEqualTo("type",typeId).andEqualTo("prepareId",classId).andIsNotNull("postition").andIsNull("wrong").andEqualTo("deleted",0);
        return userMapper.selectByExample(example);
    }

}